//
//  NoteVC.m
//  BrushFace
//
//  Created by timer_q on 16/1/21.
//  Copyright © 2016年 Zzz. All rights reserved.
//

#import "NoteVC.h"
#import "AlertDialogHelper.h"

@interface NoteVC ()

@end

@implementation NoteVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    [self.navBar setTitle:@"捎句话"];
    [self.navBar setLeftBtn:NAV_BAR_LEFT_BTN_TYPE_BLUE];
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
    UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeSystem];
    rightButton.frame = CGRectMake(0, 20, 60, 44);
    [rightButton setTitleColor:ColorDefaultBlue forState:UIControlStateNormal];
    [rightButton setTitle:@"确定" forState:UIControlStateNormal];
    [rightButton addTarget:self action:@selector(doneButtonClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.navBar setRightView:rightButton];
}
- (void)doneButtonClick:(UIButton *)sender{
    if ([self.textView.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]].length == 0||self.textView.text.length == 0) {
        [AlertDialogHelper showToast:@"请先捎话，再确认"];
        return;
    }else{
        NSString *string = [[NSString alloc] initWithString:self.textView.text];
        [self.delegate takeWord:string];
    }
    
    [self.navigationController popViewControllerAnimated:YES];
}
- (IBAction)blueBtnCLick:(id)sender {
    if (_blueBtn.selected == YES) {
        _blueBtn.selected = NO;
        _textView.text = @"";
        
    }else{
        _blueBtn.selected = YES;
        _redBtn.selected = NO;
        _orangeBtn.selected = NO;
        _textView.text = @"别问我是谁，请叫我雷锋";
    }
}
- (IBAction)redBtnClick:(id)sender {
    if (_redBtn.selected == YES) {
        _redBtn.selected = NO;
        _textView.text = @"";
    }else{
        _redBtn.selected = YES;
        _blueBtn.selected = NO;
        _orangeBtn.selected = NO;
        _textView.text = @"好基友，一辈子";
    }
}
- (IBAction)orangeBtnClick:(id)sender {
    if (_orangeBtn.selected == YES) {
        _orangeBtn.selected = NO;
        _textView.text = @"";
    }else{
        _blueBtn.selected = NO;
        _redBtn.selected = NO;
        _orangeBtn.selected = YES;
        _textView.text = @"有钱就是任性";
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
